<div class="blockcms" style="margin-left: 10px;">
    <div class="blocktitle">
        <h3>
            <a href="<?=BASE_URL?>/user/viewprofile">My Account &raquo; <?=$this->username?></a>
        </h3>
    </div>    
    <div id="accountfunction" style="padding:10px; ">
        <ul>
            <li>&raquo; <a href="<?=BASE_URL?>/user/orderhistory">My Order History</a></li>
            <li>&raquo; <a href="<?=BASE_URL?>/user/viewprofile">View My Profile</a></li>
            <li>&raquo; <a href="<?=BASE_URL?>/user/editemailcustomer">Edit My Email Address</a></li>
            <li>&raquo; <a href="<?=BASE_URL?>/user/historystorecredit">My Store Credit</a></li>
            <li>&raquo; <a href="<?=BASE_URL?>/user/changepassword">Change My Password</a></li>
            <li>&raquo; <a href="#giftcard" id="giftcardpopup">Check My Gift Balance</a></li>
            <li>&raquo; <a href="<?=BASE_URL?>/index/index/logout">Sign Out</a></li>
        </ul>
        <style>
            #accountfunction li {list-style-type:none}
        </style>
    </div>
</div>
<div style="display:none;" style="margin-left: 10px;">
    <div id="giftcard">
        <div style="font-size:16px">
            Check Gift card
        </div>
        <hr noshade="" size="1" color="#c0c0c0"/>
        
        <form action="<?=BASE_URL?>/user/checkgiftcard" method="post" id="giftcardprocesspayment">
            <table>
                <tr>
                    <td width="150">
                        Your Gift Card number
                    </td>
                    <td>
                        <input type="text" name="gcno" id="gcno" value="" class="required uniform">
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <input type="submit" class="uniform" value="Submit">
                        <input type="reset" class="uniform" value="Reset">
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>




<script type="text/javascript" src="<?php echo JS_PATH ?>/jquery/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" href="<?php echo JS_PATH ?>/jquery/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
<script type="text/javascript" language="javascript" >
    $(document).ready(function() {
    
        $('#SignatureConfirmation').click(function() {
            var checked = $(this).attr('checked');
            
            if (checked == true) {
                location.href="<?php echo BASE_URL?>/index/shop/checksignature?v=1";
            } else {
                location.href="<?php echo BASE_URL?>/index/shop/checksignature?v=0";
            }
        });
        $("#giftcardpopup").fancybox({
            'transitionIn'	:	'elastic',
            'transitionOut'	:	'elastic',
            'speedIn'		:	600, 
            'speedOut'		:	200, 
            'overlayShow'	:	true
        });
    });
    
    $("#giftcardprocesspayment").submit(function(event) {

    // stop form from submitting normally
    event.preventDefault(); 
        
    // get some values from elements on the page:
    var $form = $( this ),
        url = $form.attr( 'action' );

    // Send the data using post and put the results in a div
        $.ajax({
            url: url,
            type: "POST",
            data:{gcno: $('#gcno').val()},
            dataType: "json",
            beforeSend: function(){
                $.prompt('Please wait ...',{ buttons: {} });
            },
            success: function(responseText){
                jQuery.prompt.close();
                $.prompt(responseText.msg,{ buttons: { Ok: true }, zIndex : 1000000000 });
                
                if(responseText.success == true) {
                    //location.href = '<?php echo BASE_URL?>/index/shop/viewcart';
                } else {
                }
            },
            error: function(html){
                jQuery.prompt.close();
                $.prompt('Please check your gift card...',{ buttons: {} });
            }
        }); 
  });
</script>